package com.glodon.paas.document.service;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;

import com.glodon.paas.document.api.bean.File;
import com.glodon.paas.document.api.bean.Revision;
import com.glodon.paas.dto.DataTansitionObject;
import com.glodon.paas.storage.BulkStorage;
import com.glodon.paas.storage.ReadResult;

public interface FileService {

    String getFileId(String userId, String path);

    String getPath(String userId, String fileId, boolean encode);

    File getFile(String userId, String fileId, boolean cascade);

    // File getFileByDateBag(String datebagId);

    String generateFolderName(String userId, String parentId);

    List<File> getFiles(String userId, String fileId, String orderBy, String orderType, boolean cascade);

    List<Revision> getRevisions(String userId, String fileId);

    List<DataTansitionObject> getPath(String userId, String fileId);

    long getUsedSpace(String userId);

    File createFolder(String userId, String parentId, String path);

    File rename(String userId, String fileId, String fileName);

    File remove(String userId, String fileId);

//    File removeRevision(String userId, String fileId, Integer revisionNum);
    
    File removeRevision(String userId, String revisionId);

    void removeUploadingRevision(String userId, String fileId);

    File moveFile(String userId, String fileId, String toParentId);

    Revision getUploadingRevision(String userId, String parentId, String name, long size);

    File uploadFile(String creator, String parentId, String path, long position, long length, InputStream data);

    long getUploadedBytes(String fileId);

    ReadResult downloadFile(String userId, String fileId, int revisionNum);

    ReadResult downloadFile(String userId, String fileId, int revisionNum, long start, long end);

    void downloadFiles(String userId, String[] ids, OutputStream out);

    void downloadFolder(String userId, String folderId, OutputStream out);

    void createDataBag(String fileId);

    void lockFile(String userId, String fileId);

    void unlockFile(String userId, String fileId);
    
    File getTree(String userId, String fileId);
    
    File getProjectFolder(String userId, String projectId);
    
    void setBulkStorage(BulkStorage bulkStorage);

    BulkStorage getBulkStorage();

    int delExpiredFiles(String ownerId, int nDays, int limited);
}
